from langdev_helper.llm.lcex import llm_lcex as llm
from langdev_helper.util.search import search_with_bing
import pprint

from langchain_core.messages import AIMessage
from langchain_core.tools import tool

from langgraph.prebuilt import ToolNode

from typing import Annotated
from typing_extensions import TypedDict

from langgraph.graph import StateGraph, START, END
from langgraph.graph.message import add_messages

@tool
def bing_search(keyword: str) -> list[str]:
    """根据keyword从bing搜索互联网信息"""
    return search_with_bing('大语言模型')

# tools = [tool]

# class State(TypedDict):
#     messages: Annotated[list, add_messages]

# graph_builder = StateGraph(State)
# llm_with_tools = llm.bind_tools(tools)

# def chatbot(state: State):
#     return {"messages": [llm_with_tools.invoke(state["messages"])]}

# graph_builder.add_node("chatbot", chatbot)



data = search_with_bing('大语言模型')
pp = pprint.PrettyPrinter(indent=4)
# pp.pprint(data)


